<?php

require_once "core_local.php";



$i = 0;
$h = fopen("Property26Jul121656.txt", "r");

if (!$h) {
    return FALSE;
}

$sqltpl = 'INSERT INTO supplier_properties_low (PropertyID, GeographyLevel3ID, Property, Address, PostcodeZip, Telephone, Fax, Resort, Region, Country, PropertyType, Rating, Airport, ThumbnailURL, Image1URL, Image2URL, Image3URL, Description) values (%d,%d,"%s","%s","%s","%s","%s","%s","%s","%s","%s",%d,"%s","%s","%s","%s","%s","%s");';

while (($data=fgetcsv($h, 2000,chr(27))) !== FALSE) {

    //$i++;
    //if($i<='3'){

    $row = in($data[0]);
    $row = explode('|', $row);
      
        if(intval($row[0])!==0){
            $sql = sprintf($sqltpl, $row[0],$row[1],$row[2],$row[3],$row[4],$row[5],$row[6],$row[7],$row[8],$row[9],$row[10],$row[11],$row[12],$row[13],$row[14],$row[15],$row[16],$row[17]);
            $result = mysql_query($sql) or die (mysql_error());
        }
        
   //}
   
}
echo "Done!";